package com.fengke.service.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.builder.ToStringBuilder;

import com.fengke.dao.model.AdminModel;
import com.fengke.dao.model.AdminRoleModel;
import com.fengke.util.file.UploadedFile;

public class AgentProfileVO implements Serializable {
	private static final long serialVersionUID = 8233744196549190840L;
	private AdminModel adminModel;
	private UploadedFile idHandsImg;
	private UploadedFile idFrontImg;
	private UploadedFile idBackImg;
	private String agentRoles;
	private List<AdminRoleModel> adminRoleModelList = new ArrayList<AdminRoleModel>();
	
	public boolean isSuperAdmin() {
		if(adminRoleModelList == null || adminRoleModelList.size() <= 0) {
			return false;
		}
		for(int i = 0;i < adminRoleModelList.size(); i ++) {
			if(adminRoleModelList.get(i) != null && adminRoleModelList.get(i).getRoleModel() != null) {
				if(1 == adminRoleModelList.get(i).getRoleModel().getId()) {
					return true;
				}
			}
		}
		return false;
	}
	/**
	 * 没有1、没有3，只有2
	 * @return
	 */
	public boolean isMerchant() {
		if(adminRoleModelList == null || adminRoleModelList.size() <= 0) {
			return false;
		}
		for(int i = 0;i < adminRoleModelList.size(); i ++) {
			if(adminRoleModelList.get(i) != null && adminRoleModelList.get(i).getRoleModel() != null) {
				if(1 == adminRoleModelList.get(i).getRoleModel().getId() || 3 == adminRoleModelList.get(i).getRoleModel().getId()) {
					return false;
				}
			}
		}
		return true;
	}
	/**
	 * 1或者3都行
	 * @return
	 */
	public boolean isAdmin() {
		if(adminRoleModelList == null || adminRoleModelList.size() <= 0) {
			return false;
		}
		for(int i = 0;i < adminRoleModelList.size(); i ++) {
			if(adminRoleModelList.get(i) != null && adminRoleModelList.get(i).getRoleModel() != null) {
				if(1 == adminRoleModelList.get(i).getRoleModel().getId() || 3 == adminRoleModelList.get(i).getRoleModel().getId()) {
					return true;
				}
			}
		}
		return false;
	}
	
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
	public AdminModel getAdminModel() {
		return adminModel;
	}
	public void setAdminModel(AdminModel adminModel) {
		this.adminModel = adminModel;
	}
	public UploadedFile getIdHandsImg() {
		return idHandsImg;
	}
	public void setIdHandsImg(UploadedFile idHandsImg) {
		this.idHandsImg = idHandsImg;
	}
	public UploadedFile getIdFrontImg() {
		return idFrontImg;
	}
	public void setIdFrontImg(UploadedFile idFrontImg) {
		this.idFrontImg = idFrontImg;
	}
	public UploadedFile getIdBackImg() {
		return idBackImg;
	}
	public void setIdBackImg(UploadedFile idBackImg) {
		this.idBackImg = idBackImg;
	}
	public String getAgentRoles() {
		return agentRoles;
	}
	public void setAgentRoles(String agentRoles) {
		this.agentRoles = agentRoles;
	}
	public List<AdminRoleModel> getAdminRoleModelList() {
		return adminRoleModelList;
	}
	public void setAdminRoleModelList(List<AdminRoleModel> adminRoleModelList) {
		this.adminRoleModelList = adminRoleModelList;
	}
}
